<?php
session_start();
require_once("../config/include_tokyo.inc.php");


//访问权限验证
$userRole = $_SESSION['user_role'];
if($userRole == 1){
	//管理员
}else{
	if($userRole > 0){
		$url = "../index.php?loginError=2";//没权限
	}else{
		$url = "../index.php?loginError=3";//没登录
	}	
	echo "<script language='javascript' type='text/javascript'>";
	echo "window.location.href='$url'";
	echo "</script>";
}




$sql_select = "select * from factoryaddress  order by modifytime asc";
$result = $db->Execute($sql_select);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<!--Begin:head-->
<? $pageTitle = "地址列表"; ?>
<?php include("../head.php"); ?>
<!--End:head-->


<body>
<?php include("../topMenu.php"); ?>


<form name="listForm" action="../factory/factoryList.php" method="post">
<br>
<div id="container" >	



<div>
<a href="/factory/factoryList.php">产品列表</a>
<a href="/factory/addressInput.php">新加产品</a>
<a href="/factory/addressInput.php">新加工厂</a>
<br><br>
</div>

<div class="grayTable">	
<table>
<thead>
	<tr>
		<th scope="col" >ID</th>
		<th scope="col" >工厂名称</th>
		<th scope="col" >工厂地址</th>
	</tr>
</thead>
<tbody>	
	<?php	
	if(empty($result) || $result->RecordCount() < 1){
		echo "<tr><td colspan=3 align='center'>记录为空.</td></tr>";
	}else{
		while (!$result->EOF) {				
			$strTR = "<tr>";
			$strTR = $strTR."<td><a href='addressInput.php?id=".$result->fields['id']."'>".$result->fields['id']."</a></td>";		
			$strTR = $strTR."<td>".$result->fields['factory_name']."</td>";
			$strTR = $strTR."<td>".$result->fields['factory_address']."</td>";
			$strTR = $strTR."</tr>";
			echo $strTR;
			$result->MoveNext();
		}
	}
	?>
</tbody>
</table>	
</div>
</div><!--end container -->



</form>
</body>




</html>


